<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('考生基本信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>专业名称：</label>
                                <input type="text" name="majorName"/>
                            </li>
                            <li>
                                <label>姓名：</label>
                                <input type="text" name="studentName"/>
                            </li>
                            <li>
                                <label>省系统联系方式：</label>
                                <input type="text" name="phoneNumber"/>
                            </li>
                            <li>
                                <label>省系统邮箱：</label>
                                <input type="text" name="email"/>
                            </li>
                            <li>
                                <label>身份证号码：</label>
                                <input type="text" name="idCardNumber"/>
                            </li>
                            <li>
                                <label>助学单位代码：</label>
                                <input type="text" name="assistantUnitCode"/>
                            </li>
                            <li>
                                <label>助学单位1：</label>
                                <input type="text" name="assistantUnit1"/>
                            </li>
                            <li>
                                <label>助学单位2：</label>
                                <input type="text" name="assistantUnit2"/>
                            </li>
                            <li>
                                <label>助学单位教师：</label>
                                <input type="text" name="teacherName"/>
                            </li>
                            <li>
                                <label>校系统联系方式1：</label>
                                <input type="text" name="schoolContact1"/>
                            </li>
                            <li>
                                <label>校系统联系方式2：</label>
                                <input type="text" name="schoolContact2"/>
                            </li>
                            <li>
                                <label>校系统联系方式3：</label>
                                <input type="text" name="schoolContact3"/>
                            </li>
                            <li>
                                <label>校系统邮箱1：</label>
                                <input type="text" name="schoolEmail1"/>
                            </li>
                            <li>
                                <label>校系统邮箱2：</label>
                                <input type="text" name="schoolEmail2"/>
                            </li>
                            <li>
                                <label>是否报考学位：</label>
                                <input type="text" name="isdegree"/>
                            </li>
                            <li>
                                <label>英语水平：</label>
                                <input type="text" name="englishLevel"/>
                            </li>
                            <li>
                                <label>绘画能力：</label>
                                <input type="text" name="drawingAbility"/>
                            </li>
                            <li>
                                <label>当前学历：</label>
                                <input type="text" name="currentEducational"/>
                            </li>
                            <li>
                                <label>毕业学校：</label>
                                <input type="text" name="graduationSchool"/>
                            </li>
                            <li>
                                <label>考生所在地区：</label>
                                <input type="text" name="nowLocation"/>
                            </li>
                            <li>
                                <label>常驻城市：</label>
                                <input type="text" name="residentCity"/>
                            </li>
                            <li>
                                <label>异常信息：</label>
                                <input type="text" name="exceptionInfo"/>
                            </li>
                            <li>
                                <label>删除标记：</label>
                                <input type="text" name="deletedFlag"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="javascript:batchGenBaseInfo()" shiro:hasPermission="system:information:add">
                    <i class="fa fa-download"></i> 生成基本信息
                </a>
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:information:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:information:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:information:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:information:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:information:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:information:remove')}]];
        var prefix = ctx + "system/information";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "考生基本信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'baseId',
                    title: '基本信息id',
                    visible: false
                },
                {
                    field: 'majorName',
                    title: '专业名称'
                },
                {
                    field: 'studentName',
                    title: '姓名'
                },
                {
                    field: 'phoneNumber',
                    title: '省系统联系方式'
                },
                {
                    field: 'email',
                    title: '省系统邮箱'
                },
                {
                    field: 'idCardNumber',
                    title: '身份证号码'
                },
                {
                    field: 'assistantUnitCode',
                    title: '助学单位代码'
                },
                {
                    field: 'assistantUnit1',
                    title: '助学单位1'
                },
                {
                    field: 'assistantUnit2',
                    title: '助学单位2'
                },
                {
                    field: 'teacherName',
                    title: '助学单位教师',
                    visible: false
                },
                {
                    field: 'schoolContact1',
                    title: '校系统联系方式1',
                    visible: false
                },
                {
                    field: 'schoolContact2',
                    title: '校系统联系方式2',
                    visible: false
                },
                {
                    field: 'schoolContact3',
                    title: '校系统联系方式3',
                    visible: false
                },
                {
                    field: 'schoolEmail1',
                    title: '校系统邮箱1',
                    visible: false
                },
                {
                    field: 'schoolEmail2',
                    title: '校系统邮箱2',
                    visible: false
                },
                {
                    field: 'isdegree',
                    title: '是否报考学位',
                    visible: false
                },
                {
                    field: 'englishLevel',
                    title: '英语水平',
                    visible: false
                },
                {
                    field: 'drawingAbility',
                    title: '绘画能力',
                    visible: false
                },
                {
                    field: 'currentEducational',
                    title: '当前学历',
                    visible: false
                },
                {
                    field: 'graduationSchool',
                    title: '毕业学校',
                    visible: false
                },
                {
                    field: 'nowLocation',
                    title: '考生所在地区',
                    visible: false
                },
                {
                    field: 'residentCity',
                    title: '常驻城市',
                    visible: false
                },
                    {
                        field: 'isnormal',
                        title: '数据状态是否正常'
                    },
                {
                    field: 'exceptionInfo',
                    title: '异常信息'
                },
                {
                    field: 'deletedFlag',
                    title: '删除标记',
                    visible: false
                },
                {
                    field: 'remark',
                    title: '备注',
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.baseId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.baseId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        // 批量生成基本信息
        function batchGenBaseInfo() {
            $.modal.confirm("如果已有信息将被更新（唯一标识为身份证号），否则新增数据。确认要生成基本信息吗?", function() {
                layer.msg('执行成功,正在生成基本信息请稍候…', { icon: 1 });
                $.ajax({
                    type: "get",
                    url: prefix + "/batchGenBaseInfo",
                    success: function(result) {
                        if (result.code == web_status.SUCCESS) {
                            $.modal.msgSuccess("生成基本信息成功");
                        } else {
                            $.modal.alertError(result.msg);
                        }
                    },
                    error: function(error) {
                        $.modal.alertWarning("生成基本信息失败。");
                    }
                });
            });

        }
    </script>
</body>
</html>